/*
Uninclude: Tool for detecting unused #included files in C and C++ code.
    Copyright (C) 2012  Daniel Gutson, FuDePAN

    Uninclude is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version./

    Uninclude is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Uninclude.  If not, see <http://www.gnu.org/licenses/>.

    This is the class that determines whether a removed include is useful or not.
*/

#ifndef BINDIFF_DRIVER_H
#define BINDIFF_DRIVER_H

#include <list>
#include <string>

using namespace std;

class BinDiffDriver
{
public:
    bool binariesEqual(const string& file1, const string& file2) const
    {
        const int ret = system(("cmp " + file1 + " " + file2 + " >/dev/null" ).c_str());

        if (ret == -1)
            throw "Error invoking cmp.";
        else
        {
            switch(WEXITSTATUS(ret))
            {
                case 0:  return true;
                case 1:  return false;
                default: throw "Error when cmp ran.";
            }
        }
    }
};

#endif

